<?php defined('SYSPATH') OR die('No direct access allowed.');
if (isset($errors) && is_array($errors))
{?>
<!--
<div id="error">
<?php
	foreach ($errors as $message)
	{
	  echo __('Error:') . ' ' . $message . '<br />' . PHP_EOL;
	}
?>
</div>
-->
<?php
}
echo form::open('user/create');
?>
<fieldset>
  <legend><?php echo __('Account details'); ?></legend>
  <ol>
    <li>
      <?php
        echo Form::label('firstname', __('First Name')) . PHP_EOL;
        echo Form::input('firstname', Arr::get($fields, 'firstname'), array('id' => 'firstname', 'maxlength' => 32)) . PHP_EOL;
        if (isset($errors['firstname']))
        {
        	echo '<span class="error">' . __('Please check this box and try again') . '</span>';
        }
      ?>
    </li>
    <li>
      <?php
        echo Form::label('lastname', __('Last Name')) . PHP_EOL;
        echo Form::input('lastname', Arr::get($fields, 'lastname'), array('id' => 'lastname', 'maxlength' => 32)) . PHP_EOL;
        if (isset($errors['lastname']))
        {
        	echo '<span class="error">' . __('Please check this box and try again') . '</span>';
        }
      ?>
    </li>
    <li>
      <?php
        echo Form::label('email_address', __('E-mail Address')) . PHP_EOL;
        echo Form::input('email', Arr::get($fields, 'email'), array('id' => 'email_address', 'maxlength' => 128)) . PHP_EOL;
        if (isset($errors['email']))
        {
        	echo '<span class="error">' . __('Please check this box and try again') . '</span>';
        }
      ?>
    </li>
    <li>
      <?php
        echo Form::label('password', __('Password')) . PHP_EOL;
        echo Form::input('password', Arr::get($fields, 'password'), array('type'=> 'password', 'id' => 'password', 'maxlength' => 32)) . PHP_EOL;
        if (isset($errors['password']))
        {
        	echo '<span class="error">' . __('Please check this box and try again') . '</span>';
        }
      ?>
    </li>
    <li>
      <?php
        echo Form::label('password_confirm', __('Confirm Password')) . PHP_EOL;
        echo Form::input('password_confirm', Arr::get($fields, 'password_confirm'), array('type' => 'password', 'id' => 'password_confirm', 'maxlength' => 32)) . PHP_EOL;
        if (isset($errors['password_confirm']))
        {
        	echo '<span class="error">' . __('Please check this box and try again') . '</span>';
        }
      ?>
    </li>
	<li>
	  <?php
		echo form::hidden('token', $token);
		echo Form::submit('submit', __('Submit'), array('class' => 'submit'));
	  ?>
	</li>
  </ol>
</fieldset>
<?php
  echo form::close();
?>